package com.adv.ems.model.vo;

import com.adv.ems.db.entity.ItemOneInfoDO;
import com.adv.ems.utils.EmsUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
public class BaseOneItemVO {
    private List<Info> list;

    public BaseOneItemVO() {
        this.list = new ArrayList<Info>();
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Info {
        private Long id;
        private Long itemId;
        private String name;
        private String code;
        private String unit;

        public Info(ItemOneInfoDO itemOne, String acceptLanguage) {
            this.id = itemOne.getId();
            this.name = EmsUtil.multilingual(itemOne.getNameInfo(), acceptLanguage);
            this.code = itemOne.getCode();
            this.itemId = itemOne.getItemId();
            this.unit = itemOne.getUnit();
        }
    }
}
